global X_all 	woman_b repondant_age_b secondary_b  origine_naissance_b married_b relation_head_b relation_spouse_b relation_daughter_b relation_other_b emploi_main_b initiatives_2_b formation_b ///
				hhsize_b children_b adults_b elderly_b conso_food_pc_b conso_nofood_pc_b conso_tot_pc_b dirtfloor_b thatched_still_b proprietaire_terre_b livestock_b /// 
				distance_cheflieu_b distance_marche_b distance_transpublic_b distance_ecoleprim_b distance_eau_b 
 
global X_cont_pos repondant_age_b hhsize_b distance_ecoleprim_b distance_cheflieu_b distance_marche_b conso_food_pc_b conso_nofood_pc_b 
global X_cont_pos0 children_b adults_b conso_tot_pc_b distance_transpublic_b distance_eau_b 

				
* Polynomials of continuous variables
global X_poly

local i = 0
foreach x in $X_cont_pos $X_cont_pos0 $X_cont_posneg {

local i = `i'+1

gen `x'_2 = `x'^2
gen `x'_3 = `x'^3
gen `x'_4 = `x'^4

global X_poly $X_poly `x'_2 `x'_3 `x'_4
}

* make log-like functions of continuous variables

global X_log

local i = 0
foreach x in $X_cont_pos {

local i = `i'+1

*use Ravallion transformation for logs
gen `x'_log = log(`x')

global X_log $X_log `x'_log
}


local i = 0
foreach x in $X_cont_pos0 $X_cont_posneg {

local i = `i'+1

*use Ravallion transformation for logs
gen `x'_rav = ln(`x'+sqrt(`x'^2+1)) - ln(2) if `x'>=0
replace `x'_rav = 0.5*(exp(`x') - exp(-`x')) - ln(2) if `x'<0
*IHS function - log-like for positive numbers
gen `x'_ihs = ln(`x'+sqrt(`x'^2+1))

global X_log $X_log `x'_rav `x'_ihs
}


*make interaction terms
global X_int

local i = 0
foreach x in $X_all {
local i = `i'+1

local j = 0
foreach y in $X_all {
local j = `j'+1

if `j'>`i'{

gen v`i'v`j' = `x'*`y'
global X_int $X_int v`i'v`j'

}
}

}

* Make interaction terms, but excluding the variable of interest cd_finaldecision (for Table 2)
global X2_int

local i = 0
foreach x in $X2_all {
local i = `i'+1

local j = 0
foreach y in $X_all {
local j = `j'+1

if `j'>`i'{

gen vv`i'v`j' = `x'*`y'
global X2_int $X2_int vv`i'v`j'

}
}

}



global X_poly_and_int $X_all $X_poly $X_log $X_int

